import { FieldType } from 'choerodon-ui/pro/lib/data-set/enum';
import { DataSetProps } from 'choerodon-ui/pro/lib/data-set/DataSet';

const type = FieldType.string;
const booleanType = FieldType.boolean;

const skuDS = (): DataSetProps => ({
  primaryKey: 'numberid',
  name: 'user',
  autoQuery: true,
  pageSize: 100,
  queryUrl: '/_api/goods/getSKU',
  fields: [
    {
      name: 'numberid',
      type,
      label: '序号',
    },
    {
      name: 'name',
      type,
      label: '外部名称',
    },
    {
      name: 'code',
      type,
      label: '外部sku编码',
    },
    {
      name: 'productCode',
      type,
      label: '商品编码',
    },
    {
      name: 'productName',
      type,
      label: '商品名称',
    },
    {
      name: 'productStatus',
      type: booleanType,
      label: '商品状态',
    },
    {
      name: 'color',
      type,
      label: '颜色',
    },
    {
      name: 'size',
      type,
      label: '尺寸',
    },
    {
      name: 'type',
      type,
      label: '款式',
    },
  ],
  events: {
    submit: ({ data }: any) => console.log('submit data', data),
  },
});

export default skuDS;